import { _decorator, Component, Node } from 'cc';
import { BasePanel } from './BasePanel';
import { _game, _platform, _resource } from '../Main';
import { PanelName } from '../managers/ResourceManager';
import { Adsdk } from '../scenes/Adsdk';
const { ccclass, property } = _decorator;

@ccclass('FailPanel')
export class FailPanel extends BasePanel {
    
    panelName: string = '挑战失败'

    start() {
        Adsdk.instance.showInterstitialAd()
    }
    no() {
        this.close(() => {
            if (_game.game) {
                _game.game.quit()
            }
        })
    }

    video() {
        this.close(() => {
            if (!_game.game) {
                return
            }
            _platform.platform.showVideo(() => {
                _game.game.revive()
            }, () => {
                _resource.openPanel(_resource.getPanelPrefab(PanelName.FailPanel))
            })
        })
    }
}


